#include "UdpServer.hpp"
#include "Route.hpp"
#include <memory>

int main(int argc, char**argv)
{   
    if(argc != 2)
    {
        std::cerr <<  "Usage " << argv[0] <<" -port" << std::endl;
        exit(1);
    }
    // 获取用户输入的端口号
    uint16_t port = std::stoi(argv[1]);

    Route r;
    service_t t = std::bind(&Route::ForWard, &r, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
    
    std::unique_ptr<UdpServer> uvsr = std::make_unique<UdpServer>(t, port);// C++14
    uvsr->Init();
    uvsr->Start();

    return 0;
}